import axios from "axios";
const request = {
  fatgetNumber: (data) =>
    axios({
      method: "GET",
      url: "http://localhost:3001/data",
      params: data,
    }),
  fataddNumber: (data) =>
    axios({
      url: "http://localhost:3001/data",
      method: "POST",
      data,
    }),
  fatediNumber: (data) =>
    axios({
      url: `http://localhost:3001/data/${data.id}`,
      method: "PUT",
      data,
    }),
  // 数据回填
  fathuitianNumber: (id) =>
    axios({
      url: `http://localhost:3001/data/${id}`,
      method: "GET",
    }),
  // 删除数据
  fatdelNamber: (id) =>
    axios({
      url: `http://localhost:3001/data/${id}`,
      method: "DELETE",
    }),
  // 搜索数据
  fatsearchNamber: (name) =>
    axios({
      url: `http://localhost:3001/data/?name=${name}`,
      method: "GET",
    }),
};

export default request;
